<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/com/include/declare.jspf" %>
<%@ include file="/WEB-INF/jsp/com/include/doctype.jspf" %>
<meta name="WT.ti" content="홈">
<SCRIPT type=text/javascript charset=UTF-8    src="/kr/common/js/netfunnel-debug.js"></SCRIPT>

<script>
//쇼룸
function goIcon0(carCd){
    if(carCd){
        location.href="/kr/showroom.do?carCd1="+carCd;
    }
}
//견적내기
function goIcon1(carCd){
    if(carCd && (carCd.indexOf("BS") >= 0 || carCd.indexOf("TR") >= 0)){
        alert("견적내기 서비스를 제공하지 않는 차량입니다.");
        return;
    }
    if(carCd){
        location.href="/kr/estimation/estimationgeneral.do?carcode="+carCd;
    }else{
        location.href="/kr/estimation/estimationgeneral.do";
    }
}
//구매상담
function goIcon2(carCd){
    location.href="/kr/pur/purMgmtFrontView.do";
}
//카탈로그 신청
function goIcon3(carCd){
    if(carCd){
        location.href="/kr/ctlg/req/selectCtlgPaging.do?carCd="+carCd;
    }else{
        location.href="/kr/ctlg/req/selectCtlgPaging.do";
    }
    
}
//경쟁차 비교
function goIcon4(carCd){
    if(carCd && (carCd == "CU001" || carCd.indexOf("BS") >= 0 || carCd.indexOf("TR") >= 0)){
        alert("경쟁차 비교를 지원 하지 않는 차량입니다.");
        return;
    }
    
    if (carCd!=null) {
        location.href="/kr/estimation/compare.do?carCd="+carCd;
    } else {
        location.href="/kr/estimation/compare.do";
    }
    
}
//영업망 조회
function goIcon5(carCd){
    location.href="/kr/biz/selectBizNwrkMgmtPaging.do";
    
}
//시승서비스
function goIcon6(carCd){
    location.href="/kr/tda/index.do";
}

//메인 팝업
var _MainPopup = new Array();

function AddPopup(idx, title, width, height, left, top,  html ,imgPath) {
  var obj ={};
  obj.IDX = idx;
  obj.Title = title;
  obj.Width = width;
  obj.Height = height;
  obj.Left = left;
  obj.Top = top;
  obj.html = html;
  obj.imgPath = imgPath;
  
  _MainPopup.push(obj);
}

function PopLayerClose(idx, str){
    if($("input[name= checkHMC"+idx+"]:checked").size() > 1){
       // setCookie("HMC"+idx, "HMC"+idx+"_cookie");
    }
   
    $("#" +str ).parent().remove();
}

function ShowDefaultPopup() {
  //try {
  var TmpArr = _MainPopup.reverse();
  var left = 0;
  for(i = 0; i < TmpArr.length; i++) {
      var PopObj = TmpArr[i];
      if (i == 0) {
          left = PopObj.Left;
      }

      if(getCookie("HMC"+PopObj.IDX) != "HMC"+PopObj.IDX+"_cookie" || !getCookie("HMC"+PopObj.IDX)) {
          if (PopObj.center == "Y"){
              //openLayer(PopObj.IDX , "HMC"+i, PopObj.Width, PopObj.Height,(screen.availWidth - PopObj.Width) / 2, (screen.availHeight - PopObj.Height) / 2, PopObj.chkClose);
          } else {
              openLayer(PopObj.IDX , "HMC"+i, PopObj.Width, PopObj.Height, left, PopObj.Top, PopObj.html, PopObj.img);
          }
          left += PopObj.Width + 10;
      }
  }
  //} catch(e) {}
}

function openLayer(idx, id, width, height, posX, posY, html, img) {
  var layerInnerHTML  = "";
  var layerDiv        = document.createElement("div");
  var chkCloseStr     = "";
  var layerId         = "layerPopWrap"+idx;
  document.body.appendChild(layerDiv);

 
  
  layerDiv.id = layerId;   
 // layerDiv.style = "top:" + posX + "px;left:" + posY + "px;display:none;";
  layerDiv.style.display = "none";
  layerDiv.style.position = "absolute";
  layerDiv.style.zIndex = "10000"+idx;
  layerDiv.style.width = width + "px";
  layerDiv.style.height = height + "px";
  layerDiv.style.top =  posY + "px";
  layerDiv.style.left = posX + "px";
  

  
  var html = "";
  
  //html+='<div class="notice-popup-wrap" style="width:500px; top:550px;">';
  html+='<div class="notice-popup-inner">';
  html+='<div class="notice-popup-header">';
  html+='<h1><a href="/index.jsp"><img src="/kr/images/layerpopup/h1_logo.gif" alt="HYUNDAI" /></a></h1>';
  html+='<a href="javascript:PopLayerClose(this,"'+layerId+'");"><img src="/kr/images/layerpopup/btn_close02.gif" alt="닫기" class="close" /></a>';
  html+='</div>';
  html+='<div class="notice-popup-container">';
  if(PopObj.html == ''){
      html+='<div class="notice-popup-contents full-img-type">';    
  }else{
      html+='<div class="notice-popup-contents">';    
  }
  html+='<div class="notice-cont">';
  html+='<p class="img-title"><img src="/kr/images/layerpopup/txt_notice02.gif" alt="BLU members 회원연동 종료" /></p>';
  html+='8월 16일부터 현대자동차 홈페이지(www.hyundai.com)와<br />';
  html+='BLU members (blu.hyundai.com)의 회원연동이<br />';
  html+=' 각 웹사이트의 운영정책에 따라 종료됩니다.';
  html+='<p class="sect">';
  html+='홈페이지 이용에 착오 없으시기 바랍니다.';
  html+='</p>';
  html+='</div>';
  html+='</div>';
  html+='<p class="today-check">';
  html+='<label>';
  html+='<input type="checkbox" class="check" name="checkHMC'+idx+'"/>';
  //html+='<a href="javascript:PopLayerClose("' +idx+'","'+layerId+'");">
  html+='오늘 다시 보지 않기';
  html+='</a>';
  html+='</label>';
  html+='</p>';
  html+='</div>';
  html+='</div>';
  //html+='</div>';
  
  layerDiv.innerHTML = html;
  //fnInsertPopup(layerDiv);
  layerDiv.style.display  = "";
}

function setCookie(strName, strValue) {
  var objExpireDate = new Date();

  objExpireDate.setDate(objExpireDate.getDate() + (24 * 60 * 60 * 1000)); 
  
  document.cookie = strName + "=" + escape(strValue) + "; path=/; expires=" + objExpireDate.toGMTString() + ";";

  //alert(document.cookie);
}

function delCookie(strName) {
  var objExpireDate = new Date();

  objExpireDate.setDate(objExpireDate.getDate() - 1);
  
  document.cookie = strName + "=;expires=" + objExpireDate.toGMTString();
}

function getCookie(strName) {
  var strCookieName = strName + "=";
  var objCookie = document.cookie;
  
  if (objCookie.length > 0){
      var nBegin = objCookie.indexOf(strCookieName);
      
      if (nBegin < 0){
          return false;
      }

      nBegin += strCookieName.length;
      
      var nEnd = objCookie.indexOf(";", nBegin);
      
      if (nEnd == -1){
          nEnd = objCookie.length;
      }
  }
  //alert(objCookie.substring(nBegin, nEnd));
  
  return unescape(objCookie.substring(nBegin, nEnd));
}

function layerClose2(idx){
    setCookie("HMC"+idx, "HMC"+idx+"_cookie");
    $("#pop"+idx).hide();
} 

function layerClose(idx){
    if($("input[name=popCheck"+idx+"]:checked").size() > 1){
      // setCookie("HMC"+idx, "HMC"+idx+"_cookie");
    }
    $("#pop"+idx).hide();
}
//$(document).ready(function() {
    //NetFunnel_goComplete({"port" : "${port}","proto" : "${proto}", cookie_id:"${cookieNm}"});
//});

</script>
</head>
<body>
<%@ include file="/WEB-INF/jsp/com/include/layerpopup.jspf" %>
<div id="wrap">
    <%@ include file="/WEB-INF/jsp/com/include/navi_utill.jspf" %>
    <%@ include file="/WEB-INF/jsp/com/include/navi_header.jspf" %>
    <hr />

    <div id="main-header-wrap">
        <div id="mainvisual-motion">
            <div class="mainvisual-motion-inner">
                <c:forEach var="prmVo" items="${prmList}" varStatus="prmStatus">
                <c:if test="${prmStatus.first}">
                    <div class="v-on">
                </c:if>
                <c:if test="${!prmStatus.first}">
                    <div>
                </c:if>
                    <div class="motion-copy-wrap v-avante-txt">
                    <c:if test="${prmVo.titlImgLink != null && prmVo.titlImgLink != ''}">
                       <a href="${prmVo.titlImgLink }" <c:if test="${prmVo.titlImgTaget == 'Y'}">target="_blank"</c:if>><img src="<c:url value="${prmVo.titlImgPath}"/>" alt="" class="fadeElement" /></a> 
                    </c:if>
                    <c:if test="${prmVo.titlImgLink == null || prmVo.titlImgLink == ''}">
                        <img src="<c:url value="${prmVo.titlImgPath}"/>" alt="" class="fadeElement" />
                    </c:if>
                    </div>
                    <div class="motion-car-wrap v-avante-car">
                    <c:if test="${prmVo.carImgLink != null && prmVo.carImgLink != ''}">
                       <a href="${prmVo.carImgLink }" <c:if test="${prmVo.carImgTaget == 'Y'}">target="_blank"</c:if> ><img src="<c:url value="${prmVo.carImgPath}"/>" alt="" class="fadeElement" /></a> 
                    </c:if>
                    <c:if test="${prmVo.carImgLink == null || prmVo.carImgLink == ''}">
                        <img src="<c:url value="${prmVo.carImgPath}"/>" alt="" class="fadeElement" />
                    </c:if>
                    </div>
                    <div class="motion-icon-wrap">
                    <c:if test="${prmVo.estRqButnExpsYn == 'Y' || prmVo.purCnsButnExpsYn == 'Y' || prmVo.ctlgPttButnExpsYn == 'Y' ||prmVo.carCprButnExpsYn == 'Y' || prmVo.bizNwrkIqButnExpsYn == 'Y' || prmVo.tsrdSvcButnExpsYn == 'Y'}">
                    <div class="motion-icon">
                        <div class="inner">
                            <ul>
                                <li>
                                    <a href="javascript:goIcon0('${prmVo.vehlCd }');"><img src="/kr/images/main/icon07.png" alt="쇼룸바로가기" class="icon"></a>
                                    <a href="javascript:goIcon0('${prmVo.vehlCd }');"><img src="/kr/images/main/icon07_baloon.png" alt="오버 이미지" class="baloon"></a>
                                </li>
                                <c:if test="${prmVo.estRqButnExpsYn == 'Y'}">
                                <li>
                                    <a href="javascript:goIcon1('${prmVo.vehlCd }');"><img src="/kr/images/main/icon01.png" alt="견적내기" class="icon" /></a>
                                    <a href="javascript:goIcon1('${prmVo.vehlCd }');"><img src="/kr/images/main/icon01_baloon.png" alt="오버 이미지" class="baloon" /></a>
                                </li>
                                </c:if>
                                <c:if test="${prmVo.purCnsButnExpsYn == 'Y'}">
                                <li>
                                    <a href="javascript:goIcon2('${prmVo.vehlCd }');"><img src="/kr/images/main/icon02.png" alt="구매상담" class="icon" /></a>
                                    <a href="javascript:goIcon2('${prmVo.vehlCd }');"><img src="/kr/images/main/icon02_baloon.png" alt="오버 이미지" class="baloon" /></a>
                                </li>
                                </c:if>
                                <c:if test="${prmVo.ctlgPttButnExpsYn == 'Y'}">
                                <li>
                                    <a href="javascript:goIcon3('${prmVo.vehlCd }');"><img src="/kr/images/main/icon03.png" alt="카탈로그 신청" class="icon" /></a>
                                    <a href="javascript:goIcon3('${prmVo.vehlCd }');"><img src="/kr/images/main/icon03_baloon.png" alt="오버 이미지" class="baloon" /></a>
                                </li>
                                </c:if>
                                <c:if test="${prmVo.carCprButnExpsYn == 'Y'}">
                                <li>
                                    <a href="javascript:goIcon4('${prmVo.vehlCd }');"><img src="/kr/images/main/icon04.png" alt="경쟁차 비교" class="icon" /></a>
                                    <a href="javascript:goIcon4('${prmVo.vehlCd }');"><img src="/kr/images/main/icon04_baloon.png" alt="오버 이미지" class="baloon" /></a>
                                </li>
                                </c:if>
                                <c:if test="${prmVo.bizNwrkIqButnExpsYn == 'Y'}">
                                <li>
                                    <a href="javascript:goIcon5('${prmVo.vehlCd }');"><img src="/kr/images/main/icon05.png" alt="영업망 조회" class="icon" /></a>
                                    <a href="javascript:goIcon5('${prmVo.vehlCd }');"><img src="/kr/images/main/icon05_baloon.png" alt="오버 이미지" class="baloon" /></a>
                                </li>
                                </c:if>
                                <c:if test="${prmVo.tsrdSvcButnExpsYn == 'Y'}">
                                <li>
                                    <a href="javascript:goIcon6('${prmVo.vehlCd }');"><img src="/kr/images/main/icon06.png" alt="시승서비스" class="icon" /></a>
                                    <a href="javascript:goIcon6('${prmVo.vehlCd }');"><img src="/kr/images/main/icon06_baloon.png" alt="오버 이미지" class="baloon" /></a>
                                </li>
                                </c:if>
                            </ul>
                        </div>
                    </div>
                    </c:if>
                    </div>
                </div>
                <style>
                .motion-cont-${prmStatus.count} {
                    background:url('<c:url value="${prmVo.surrImgPath}"/>') no-repeat center top;
                }
                </style>
                </c:forEach>
            </div>
        </div> 
        <hr />
        <div class="motioncar-list-wrap">
            <ul class="motioncar-list">
                <c:forEach var="prmVo" items="${prmList}" varStatus="prmStatus">
                <li><div><span class="item${prmStatus.count}"><em>${prmVo.prNm }</em></span></div></li>
                <style>
                    .motioncar-list li.fn-on div span.item${prmStatus.count} {
                        background-position:0 -24px;
                    }
                    .motioncar-list li div span.item${prmStatus.count} {
                        background:url('<c:url value="${prmVo.menuImgPath}"/>') no-repeat;
                    }
                    
                    
                </style>
                </c:forEach>
            </ul>
        </div>
        <hr />
        <div class="contview-btn-wrap">
            <div class="contview-btn"><a href="#" class="go"><img src="/kr/images/main/btn_contentsview.png" alt="content view" /></a></div>
        </div>
    </div>
    <hr />
    <div id="main-container">
        <div id="main-article">
            <!-- service list -->
            <div class="main-service-list-wrap">
            <h2><img src="/kr/images/title/h2_main07.gif" alt="EVENT"></h2>
            <ul class="main-service-list">
                 <c:forEach var="evntVo" items="${evnttList}" varStatus="evntStatus">
                <li>
                    <a href="/kr/evnt/selectEvntMnDetail.do?evntMnSn=${evntVo.evntMnSn}"><img src="<c:url value="${evntVo.mnThumnImgPath}"/>" alt="" class="thumb" /></a>
                    <div class="service-periord">
                        <a href="/kr/evnt/selectEvntMnDetail.do?evntMnSn=${evntVo.evntMnSn}">${fnc:cutString(evntVo.evntTitl,"...",18) }</a>
                        <p class="periord">${fn:substring(evntVo.strtDt, 0, 4)}-${fn:substring(evntVo.strtDt, 4, 6)}-${fn:substring(evntVo.strtDt, 6, 8)} ~ ${fn:substring(evntVo.fnhDt, 0, 4)}-${fn:substring(evntVo.fnhDt, 4, 6)}-${fn:substring(evntVo.fnhDt, 6, 8)}</p>
                    </div>
                </li>
                </c:forEach>
            </ul>
            <a href="/kr/evnt/selectEvntMnPaging.do"><img src="/kr/images/common/button/btn_more02.gif" alt="더보기" class="go"></a>
            </div>
            <!-- //service list -->
            <!-- social contents -->
            <script src="${snsHttpDomain}/sns/main.php?type=7&js=1" type="text/javascript" charset="utf-8"></script>
            <!-- //social contents -->
            <!-- news notice contents -->
            <div class="news-notice-area">
                <div class="news-area">
                    <h2><img src="/kr/images/title/h2_main05.gif" alt="제품뉴스" /></h2>
                    <ul class="list">
                        <c:forEach var="result" items="${neList}">
                            <li><p><a href="#">${fnc:cutString(result.titl,"...",20) }</a></p></li>
                        </c:forEach>
                    </ul>
                    <!-- news thumbnail -->
                    <c:forEach var="result" items="${neList}"> 
                        <div class="news-thumb">
                            <c:if test="${not empty result.thumnImgNm}">
                                <img src="http://pr.hyundai.com/Files/Promotion/News/PressRelease/${result.thumnImgNm}" alt="" class="thumb" />
                            </c:if>
                            <c:if test="${empty result.thumnImgNm}">
                                <c:if test="${not empty result.thumnImgPath}">
                                    <img src="/kr/file/imagePathView.do?nrFilNm=${result.thumnImgPath }" alt="" class="thumb" />
                                </c:if>
                                <c:if test="${empty result.thumnImgPath}">
                                    <img src="/kr/images/main/img_news.jpg" alt="" class="thumb" />
                                </c:if>
                            </c:if>
                            <dl class="news-text">
                                <dt>${result.titl }</dt>
                                <dd><a href="/kr/news/selectNewsDetail.do?blcSn=${result.blcSn}">${fnc:cutString(result.sbc,"...",125) }</a></dd>
                            </dl>
                        </div>
                    </c:forEach>
                    <a href="/kr/news/selectNewsPaging.do"><img src="/kr/images/common/button/btn_more02.gif" alt="더보기" class="go"></a>
                    <!-- //news thumbnail -->
                </div>
                <div class="notice-area">
                    <h2><img src="/kr/images/title/h2_main06.gif" alt="공지사항" /></h2>
                    <ul class="notice">
                        <c:forEach var="result2" items="${noList}">
                            <li><a href="/kr/news/selectNewsDetail.do?blcSn=${result2.blcSn}">${fnc:cutString(result2.titl,"...",18) }</a></li>
                        </c:forEach>
                    </ul>
                    <a href="/kr/news/selectNewsPaging.do"><img src="/kr/images/common/button/btn_more02.gif" alt="더보기" class="go"></a>
                </div>
            </div>
            <!-- //news notice contents -->
        </div>
    </div>
    <hr />
    <c:set value="10000" var="popNum"/>
    <c:forEach var="popVo" items="${popList}" varStatus="popStatus">
       <div id="pop${popVo.popuMgmtSn }" class="notice-popup-wrap" style="display:none;position : absolute; z-index : ${popNum+popVo.popuMgmtSn };width:${popVo.wdth}px; height: ${popVo.lenw}px; top:${popVo.popuXa}px; left:${popVo.popuYa}px;"><div class="notice-popup-inner">
        <div class="notice-popup-header">
            <h1><a href="/index.jsp"><img src="/kr/images/layerpopup/h1_logo.gif" alt="HYUNDAI"></a></h1>
            <a href="javascript:layerClose('${popVo.popuMgmtSn }');"><img src="/kr/images/layerpopup/btn_close02.gif" alt="닫기" class="close"></a>
        </div>
        <div class="notice-popup-container">
            <c:if test="${popVo.expl == '' || popVo.expl==null}"> 
                <div class="notice-popup-contents full-img-type">  
            </c:if>
            
            <c:if test="${ popVo.expl!=null && popVo.expl != ''}">
                <div class="notice-popup-contents">
            </c:if>
            
            <div class="notice-cont"> 
                    <p class="img-title">
                    <c:if test="${popVo.imgLk=='' || popVo.imgLk == null }">
                        <c:if test="${popVo.imgPath !='' && popVo.imgPath != null }">
                           <img src="/kr/file/imagePathView.do?nrFilNm=${popVo.imgPath}" alt="${popVo.popuTitl}">
                        </c:if>
                    </c:if>
                    <c:if test="${popVo.imgLk != null && popVo.imgLk != ''}">
                        <c:if test="${popVo.imgPath !='' && popVo.imgPath != null }">
                           <a href="${popVo.imgLk}"><img src="/kr/file/imagePathView.do?nrFilNm=${popVo.imgPath}" alt="${popVo.popuTitl}"></a>
                        </c:if> 
                    </c:if> 
                    </p>
                    ${popVo.expl }
                </div>
            </div>
            <p class="today-check">
                <label>
                    <input type="checkbox" class="check" id="popCheck${popVo.popuMgmtSn }" onclick="layerClose2('${popVo.popuMgmtSn }');">
                    오늘 다시 보지 않기
                </label>
            </p>
        </div>
    </div></div> 
    <script>
    
    if(getCookie("HMC"+${popVo.popuMgmtSn }) != "HMC"+${popVo.popuMgmtSn }+"_cookie" || !getCookie("HMC"+${popVo.popuMgmtSn })){
        $("#pop"+${popVo.popuMgmtSn }).show(); 
    }else{ 
        
    }
    </script>
    </c:forEach>
    <%@ include file="/WEB-INF/jsp/com/include/footer.jspf" %>


    